<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import {mapGetters} from 'vuex';
// import authRouter from '@/router/authRouter'
// console.log(authRouter);
  export default {
    name: 'App',
    computed:{
      ...mapGetters('user',['isLogin'])
    },
    created(){
      //判断用户是否登录
      // if(this.$store.getters['user/isLogin']){} 同下
      if(this.isLogin){
        // this.$router.addRoute(authRouter)
        this.$store.commit('addAuthRouter')
      }
    }
  }
</script>

<style >
body{
  margin: 0;
  padding: 0;
  background-color: rgba(230, 230, 230, 0.432);
}
</style>